<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">

<div th:replace="include/header::head"></div>

<div th:replace="include/manager_header::navbar(${loginManager})"></div>

<div class="container">
	<h1>
		<img th:src="@{/static/img/exam-admin.png}" /> 系统管理
	</h1>
	<div th:if="${!application.init}" class="exam-alert">没有设置管理员帐号，默认管理员帐号存在安全风险，请尽快处理！</div>
	<br />
	<table class="table table-striped table-bordered">
		<thead>
		<tr>
			<th class="span3">考试名称</th>
			<th class="span3">考试时间</th>
			<th>创建人</th>
			<th>上传试卷</th>
			<th>自动开始</th>
			<th>进行中</th>
			<th>已结束</th>
			<th>已归档</th>
			<th>已清理</th>
			<th>&nbsp;</th>
		</tr>
		</thead>
		<tbody>
		<tr th:each="exam : ${examList}">
			<td th:text="${exam.name}"></td>
			<td th:text="${#dates.format(exam.time, 'yyyy-MM-dd HH:mm:ss')}"></td>
	<!--		<td th:text="${exam.teacher.tname}"></td>-->
			<td th:text="${exam.teacherName}"></td>
			<td>
				<i class="icon-ok" th:if="${exam.paper != null and !#strings.isEmpty(exam.paper)}"></i>
			</td>
			<td>
				<i class="icon-ok" th:if="${exam.isAutostart != null and exam.isAutostart}"></i>
			</td>
			<td>
				<i class="icon-ok" th:if="${exam.isActive != null and exam.isActive}"></i>
			</td>
			<td>
				<i class="icon-ok" th:if="${exam.isFinish != null and exam.isFinish}"></i>
			</td>
			<td>
				<i class="icon-ok" th:if="${exam.isArchived != null and exam.isArchived}"></i>
			</td>
			<td>
				<i class="icon-ok" th:if="${exam.isCleared != null and exam.isCleared}"></i>
			</td>
			<td>
					<span th:if="${(exam.isCleared == null or !exam.isCleared) and exam.isArchived}">
						<a class="btn" th:href="@{'/admin/exam/clear/'+ ${exam.id}}">
							<i class="icon-remove-sign"></i> 清理
						</a>
					</span>
				<span th:if="${exam.isCleared != null and exam.isCleared}">
						<a class="btn" th:href="@{'/admin/exam/delete' + ${exam.id}}">
							<i class="icon-trash"></i> 删除
						</a>
					</span>
			</td>
		</tr>
		</tbody>
	</table>
</div>

<div th:replace="include/manager_footer::footer"></div>
